﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using Kunlun.Models;
using Kunlun.BusinessLogic;

namespace Kunlun.Areas.Help.Controllers
{
    public class HomeController : Controller
    {
        /// <summary>
        /// 帮助中心
        /// </summary>
        /// <param name="id">帮助id</param>
        public ActionResult Question(int id)
        {
            var model = KunlunHelp.GetHelpModel(id);

            return View(model);
        }

		/// <summary>
		/// 帮助导航
		/// </summary>
        public ActionResult helpmenu(int id)
        {
			var mlist = KunlunHelp.GetAllHelptype();
			ViewData["CurID"] = id;

            return PartialView(mlist);
        }

        /// <summary>
        /// 新闻动态详情
        /// </summary>
        public ActionResult NewsCon(int id)
        {
            var model = KunlunHelp.GetNewsModel(id);
            return View(model);
        }

		/// <summary>
		/// 新闻动态列表
		/// </summary>
		/// <param name="page"></param>
		/// <returns></returns>
        public ActionResult newsList(int? page)
        {
            PageModel model = new PageModel();
            page = page ?? 1;

            int count;
            int pageindex = Convert.ToInt32(page - 1);
            model.PageIndex = pageindex;
            model.PageSize = 20;

            var plist = KunlunHelp.GetPageListNews(0, 20 ,out count);
            model.ItemCount = count;
            ViewBag.Page = model;

            return View(plist);
        }

    }
}
